/**
 * 
 */
package com.curso.sesion10;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @author Peter
 *
 */
public class DeserializeDemo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Employee e = null;
		FileInputStream fileIn = null;
		ObjectInputStream in = null;
		
		try {
			 fileIn = new FileInputStream("D:\\programacion\\Employee.txt");
			 in = new ObjectInputStream(fileIn);
			e = (Employee) in.readObject();
			}catch (IOException i) {
				// TODO: handle exception
				System.out.println("Employee File not found");
				i.printStackTrace();
				return;
			}catch (ClassNotFoundException c) {
				// TODO: handle exception
				System.out.println("Employee class not found");
				c.printStackTrace();
				return;
			}finally {
				try {
					if (in != null){
						in.close();
					}
					if (fileIn != null){
						fileIn.close();
					}
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}

		System.out.println("Deserialized Employee..");
		System.out.println("Name:"+ e.name);
		System.out.println("Address."+ e.address);
		System.out.println("SSN:"+ e.SSN);
		System.out.println("Number:"+ e.name);
		
	
	}
}
